<template>
  <el-dialog
    title="角色详情"
    :visible.sync="dialogVisible"
    :before-close="closeDialog"
    class=""
    width="70%"
    :close-on-click-modal="false"
    :append-to-body="true"
  >
    <!-- <div class="title-gra plr30">
      <div class="grab gra-r">
        <span class="grab gra-l"></span>
      </div>
    </div> -->
    <div>
      <el-form :model="ruleForm" ref="ruleForm" label-width="200px">
        <!-- <el-form-item label="角色Id：">
          {{ ruleForm.id }}
        </el-form-item> -->
        <el-form-item style="text-align:left" label="角色名称：">
          {{ ruleForm.roleName }}
        </el-form-item>
        <!-- <el-form-item label="安全等级Id：">
          {{ ruleForm.securityLevelId }}
        </el-form-item> -->
        <el-form-item label="角色期限：">
          {{ ruleForm.roleLimit | parseTime }}
        </el-form-item>
        <el-form-item label="可访问数据期限开始日期：" show-overflow-tooltip>
          {{ ruleForm.roleDataStartTime | parseTime }}
        </el-form-item>
        <el-form-item label="可访问数据期限结束日期：">
          {{ ruleForm.roleDataEndTime | parseTime }}
        </el-form-item>
        <el-form-item label="角色状态：">
          {{ ruleForm.roleState }}
        </el-form-item>
      </el-form>
      <div class="mr-btn">
        <el-button class="golable-sty-btn" type="primary" @click="closeDialog">确定</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import { getRoleListDetail } from "@/api/roleApi.js";
export default {
  data() {
    return {
      dialogVisible: false,
      roleId: "",
      ruleForm: {}
    };
  },
  methods: {
    openDialogVisible(val) {
      this.dialogVisible = true;
      this.roleId = val.id;
      this.getRoleInfo();
    },
    getRoleInfo() {
      getRoleListDetail(this.roleId).then(res => {
        if (res) {
          this.ruleForm = res;
        }
      });
    },
    closeDialog() {
      this.$emit("callBack");
      this.dialogVisible = false;
    }
  }
};
</script>
